Skip to content

Conversation

@Akshay-Rohatgi
Copy link
Contributor

What this PR does / why we need it

The ServiceMonitor template would only render and install for monitoring.coreos.com only. On AKS Managed Prometheus clusters that ship only azmonitoring.coreos.com, Helm skips rendering the ServiceMonitor even with serviceMonitor.enabled being set to true and an apiVersion override.

This change is an approach to gating the template that is consistent with other exporters within this repository.

Which issue this PR fixes

Special notes for your reviewer

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

Comment on lines +1 to 2
{{- if .Values.serviceMonitor.enabled }}
apiVersion: {{ .Values.serviceMonitor.apiVersion | default "monitoring.coreos.com/v1" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever try this?

Suggested change
{{- if .Values.serviceMonitor.enabled }}
apiVersion: {{ .Values.serviceMonitor.apiVersion | default "monitoring.coreos.com/v1" }}
{{- $monitorApiVersion := .Values.serviceMonitor.apiVersion | default "monitoring.coreos.com/v1" }}
{{- if and ( .Capabilities.APIVersions.Has $monitorApiVersion ) ( .Values.serviceMonitor.enabled ) }}
apiVersion: {{ $monitorApiVersion }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants